<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- 斐波那契数列 -->
    <script>
        function fib(n) {
            var num1 = 1, num2 = 1, num3;
            for (var i = 3; i <= n; i++) {
                num3 = num1 + num2;
                num1 = num2;
                num2 = num3;
            }
            return num3;
        }
        console.log(fib(8));
        
    </script>
</body>

</html>